# Contributor: qaqland <qaq@qaq.land>
# Maintainer: qaqland <qaq@qaq.land>
pkgname=libtbox
pkgver=1.7.5
pkgrel=1
pkgdesc="A glib-like multi-platform c library"
url="https://github.com/tboox/tbox"
arch="all"
license="Apache-2.0"
subpackages="$pkgname-dev"
makedepends="linux-headers"
source="$pkgname-$pkgver.tar.gz::https://github.com/tboox/tbox/archive/refs/tags/v$pkgver.tar.gz
	$pkgname.pc
	"
builddir="$srcdir/tbox-$pkgver"

prepare() {
	default_prepare
	chmod -x ./*.md
}

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--kind=shared \
		--force_utf8=yes \
		--charset=yes \
		--float=yes \
		--hash=yes
	make
}

check() {
	make run
}

package() {
	make DESTDIR="$pkgdir" install
	rm "$pkgdir/usr/bin/demo"

	mkdir -p "$pkgdir/usr/lib/pkgconfig/"
	sed "s/@VERSION@/$pkgver/" "$srcdir/$pkgname.pc" > "$pkgdir/usr/lib/pkgconfig/$pkgname.pc"
}

sha512sums="
e451b0e24db3c80028ec841f0696bcb9e086745f399de1a996955b6508f0504dc22931e0ef70f298a4776619e4b96dbe5f517275d26263b3ad1076d6b5292682  libtbox-1.7.5.tar.gz
9b9e41014af55df80419fde320784e396a6a54005cf09393567f43ce146b94494090927fdfa2685edf3b72bc5ff4d155c99a037d4ea8c9a3cb649187ac4c9a32  libtbox.pc
"
